Create token [ap-3]
curl --request POST \
--url https://eu.id.resistant.ai/oauth2/ausp40dse1Q0rzDq6417/v1/token \
--header 'Authorization: Basic <encoded-value>' \
--header 'Content-Type: application/x-www-form-urlencoded' \
--data grant_type=client_credentials \
--data 'scope=<string>'import requests
url = "https://eu.id.resistant.ai/oauth2/ausp40dse1Q0rzDq6417/v1/token"
payload = {
"grant_type": "client_credentials",
"scope": "<string>"
}
headers = {
"Authorization": "Basic <encoded-value>",
"Content-Type": "application/x-www-form-urlencoded"
}
response = requests.post(url, data=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {
Authorization: 'Basic <encoded-value>',
'Content-Type': 'application/x-www-form-urlencoded'
},
body: new URLSearchParams({grant_type: 'client_credentials', scope: '<string>'})
};
fetch('https://eu.id.resistant.ai/oauth2/ausp40dse1Q0rzDq6417/v1/token', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://eu.id.resistant.ai/oauth2/ausp40dse1Q0rzDq6417/v1/token",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => "grant_type=client_credentials&scope=%3Cstring%3E",
CURLOPT_HTTPHEADER => [
"Authorization: Basic <encoded-value>",
"Content-Type: application/x-www-form-urlencoded"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://eu.id.resistant.ai/oauth2/ausp40dse1Q0rzDq6417/v1/token"
payload := strings.NewReader("grant_type=client_credentials&scope=%3Cstring%3E")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Basic <encoded-value>")
req.Header.Add("Content-Type", "application/x-www-form-urlencoded")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://eu.id.resistant.ai/oauth2/ausp40dse1Q0rzDq6417/v1/token")
.header("Authorization", "Basic <encoded-value>")
.header("Content-Type", "application/x-www-form-urlencoded")
.body("grant_type=client_credentials&scope=%3Cstring%3E")
.asString();require 'uri'
require 'net/http'
url = URI("https://eu.id.resistant.ai/oauth2/ausp40dse1Q0rzDq6417/v1/token")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Basic <encoded-value>'
request["Content-Type"] = 'application/x-www-form-urlencoded'
request.body = "grant_type=client_credentials&scope=%3Cstring%3E"
response = http.request(request)
puts response.read_body{
"access_token": "<string>",
"device_secret": "<string>",
"expires_in": 123,
"id_token": "<string>",
"refresh_token": "<string>",
"scope": "<string>",
"token_type": "Bearer"
}{
"error": "<string>",
"error_description": "<string>"
}{
"error": "<string>",
"error_description": "<string>"
}{
"error": "<string>",
"error_description": "<string>"
}{
"errorCauses": [
{
"errorSummary": "<string>"
}
],
"errorCode": "<string>",
"errorId": "<string>",
"errorLink": "<string>",
"errorSummary": "<string>"
}API Reference
Create token [ap-3]
This endpoint returns access tokens, ID tokens, and refresh tokens depending on the request parameters. For password, client credentials, SAML 2.0 assertion, and refresh token flows, calling /token is the only step of the flow. For the authorization code flow, calling /token is the second step of the flow.
Note: The
/tokenendpoint requires client authentication. The method is configured per client app. See Client authentication methods.
POST
/
token
Create token [ap-3]
curl --request POST \
--url https://eu.id.resistant.ai/oauth2/ausp40dse1Q0rzDq6417/v1/token \
--header 'Authorization: Basic <encoded-value>' \
--header 'Content-Type: application/x-www-form-urlencoded' \
--data grant_type=client_credentials \
--data 'scope=<string>'import requests
url = "https://eu.id.resistant.ai/oauth2/ausp40dse1Q0rzDq6417/v1/token"
payload = {
"grant_type": "client_credentials",
"scope": "<string>"
}
headers = {
"Authorization": "Basic <encoded-value>",
"Content-Type": "application/x-www-form-urlencoded"
}
response = requests.post(url, data=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {
Authorization: 'Basic <encoded-value>',
'Content-Type': 'application/x-www-form-urlencoded'
},
body: new URLSearchParams({grant_type: 'client_credentials', scope: '<string>'})
};
fetch('https://eu.id.resistant.ai/oauth2/ausp40dse1Q0rzDq6417/v1/token', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://eu.id.resistant.ai/oauth2/ausp40dse1Q0rzDq6417/v1/token",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => "grant_type=client_credentials&scope=%3Cstring%3E",
CURLOPT_HTTPHEADER => [
"Authorization: Basic <encoded-value>",
"Content-Type: application/x-www-form-urlencoded"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://eu.id.resistant.ai/oauth2/ausp40dse1Q0rzDq6417/v1/token"
payload := strings.NewReader("grant_type=client_credentials&scope=%3Cstring%3E")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Basic <encoded-value>")
req.Header.Add("Content-Type", "application/x-www-form-urlencoded")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://eu.id.resistant.ai/oauth2/ausp40dse1Q0rzDq6417/v1/token")
.header("Authorization", "Basic <encoded-value>")
.header("Content-Type", "application/x-www-form-urlencoded")
.body("grant_type=client_credentials&scope=%3Cstring%3E")
.asString();require 'uri'
require 'net/http'
url = URI("https://eu.id.resistant.ai/oauth2/ausp40dse1Q0rzDq6417/v1/token")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Basic <encoded-value>'
request["Content-Type"] = 'application/x-www-form-urlencoded'
request.body = "grant_type=client_credentials&scope=%3Cstring%3E"
response = http.request(request)
puts response.read_body{
"access_token": "<string>",
"device_secret": "<string>",
"expires_in": 123,
"id_token": "<string>",
"refresh_token": "<string>",
"scope": "<string>",
"token_type": "Bearer"
}{
"error": "<string>",
"error_description": "<string>"
}{
"error": "<string>",
"error_description": "<string>"
}{
"error": "<string>",
"error_description": "<string>"
}{
"errorCauses": [
{
"errorSummary": "<string>"
}
],
"errorCode": "<string>",
"errorId": "<string>",
"errorLink": "<string>",
"errorSummary": "<string>"
}Authorizations
Pass the client credentials concatenated with a : and base64-encoded as part of the Authorization header prefixed with Basic
Authorization: Basic {base64(<client_id>:<client_secret>)}
Authorization: Basic MGpyYWJ5UVdtNEI5elZKUGJvdFk6NVc3WFVMQ0VzNEJKS25XVVh3aDhsZ21lWFJoY0djZFZpRnA4NHBXZQ==
Body
application/x-www-form-urlencoded
Response
Based on the scopes requested. The scopes specified in a request are included in the access token in the response.
Was this page helpful?